package cn.com.blueInfo.bpm.template.convert;

import cn.com.blueInfo.bpm.common.convert.BaseConvert;
import cn.com.blueInfo.bpm.template.entity.WorkItem;
import cn.com.blueInfo.bpm.template.request.WorkItemDTO;
import cn.com.blueInfo.bpm.template.response.WorkItemVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 节点任务实例表 对象转换
 * @author suxch
 * @since 2025-08-31 16:23:18
 */
@Mapper(componentModel = "spring")
public interface WorkItemConvert
        extends BaseConvert<WorkItem, WorkItemDTO, WorkItemVO> {

    WorkItem dtoToEntity(WorkItemDTO dto);

    WorkItem dtoToEntity(WorkItemDTO.UpdatePartialDTO dto);

    @Mapping(source = "status", target = "status", qualifiedByName = "enumToDesc")
    @Mapping(source = "deleted", target = "deleted", qualifiedByName = "enumToDesc")
    @Mapping(source = "workItemStatus", target = "workItemStatus", qualifiedByName = "enumToDesc")
    WorkItemVO entityToVO(WorkItem entity);

}